<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>My-host</title>
<!--百度-->
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<link rel="stylesheet" href="css/style.css">
<style>
    * {
  box-sizing: border-box;
  outline: none;
}

:root {
  --bg-color: #f5f8ff;
  --main-color: #353536;
  --secondary-color: #8e92a4;
  --main-text-color: #5d606b;
  --secondary-dark-color: #9496a5;
  --tag-color-one: #e0fbf6;
  --tag-color-text-one: #58c2a9;
  --tag-color-two: #ece7fe;
  --tag-color-text-two: #8972f3;
  --tag-color-three: #fde7ea;
  --tag-color-text-three: #e77f89;
  --tag-color-four: #f7f8fc;
  --tag-color-text-four: #a0a6b5;
  --checkbox-color: #009e90;
  --button-color: #49beb7;
  --box-color: #fff1d6;
  --box-color-2: #d3e6ff;
  --box-color-3: #ffd9d9;
  --box-color-4: #daffe5;
  --task-color: #777982;
}

body, .item, .top-part, .top-part .count {
  display: flex;
  align-items: center;
}

body {
  margin: 0;
  justify-content: center;
  flex-direction: column;
  overflow: auto;
  width: 100%;
  height: 100vh;
  padding: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  background-image: linear-gradient(21deg, rgba(64, 83, 206, 0.3697003235) 68%, rgba(255, 206, 196, 0.5) 163%), linear-gradient(163deg, rgba(49, 146, 170, 0.0794448997) 86%, rgba(239, 112, 138, 0.5) 40%), linear-gradient(30deg, rgba(76, 79, 173, 0.6173675717) 22%, rgba(237, 106, 134, 0.5) 169%), linear-gradient(48deg, rgba(31, 85, 147, 0.7323890642) 64%, rgba(247, 126, 132, 0.5) 43%);
  background-blend-mode: overlay,multiply,color,normal;
}

ul {
  list-style-type: none;
  padding: 0;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

.task-manager {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  max-height: 900px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 0.3px 2.2px rgba(0, 0, 0, 0.011), 0 0.7px 5.3px rgba(0, 0, 0, 0.016), 0 1.3px 10px rgba(0, 0, 0, 0.02), 0 2.2px 17.9px rgba(0, 0, 0, 0.024), 0 4.2px 33.4px rgba(0, 0, 0, 0.029), 0 10px 80px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.left-bar {
  background-color: var(--bg-color);
  width: 230px;
  border-right: 1px solid #e3e7f7;
  position: relative;
}

.left-content {
  padding: 40px;
}

.item {
  color: var(--main-color);
  margin-bottom: 14px;
  font-weight: 500;
}
.item svg {
  width: 14px;
  height: 14px;
  color: currentcolor;
  margin-right: 10px;
}

.category-list {
  margin-top: 50px;
}
.category-list .item {
  color: var(--secondary-color);
}

.actions {
  padding: 12px;
  display: flex;
  justify-content: space-between;
}

.circle {
  border-radius: 50%;
  width: 10px;
  height: 10px;
  background-color: #fe4d46;
  box-shadow: 14px 0 0 0 #fbc023, 28px 0 0 0 #7dd21f;
}

.circle-2 {
  border-radius: 50%;
  width: 4px;
  height: 4px;
  background-color: #d5d7e3;
  box-shadow: -6px 0 0 0 #d5d7e3, 6px 0 0 0 #d5d7e3;
}

.right-bar {
  width: 320px;
  border-left: 1px solid #e3e7f7;
  display: flex;
  flex-direction: column;
}
.right-bar .header {
  font-size: 20px;
  color: var(--main-text-color);
  margin-left: 30px;
}

.top-part {
  padding: 30px;
  align-self: flex-end;
}
.top-part svg {
  width: 14px;
  height: 14px;
  color: var(--main-color);
  margin-right: 14px;
}
.top-part .count {
  font-size: 12px;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  background-color: #623ce8;
  color: #fff;
  justify-content: center;
}

.right-content {
  padding: 10px 40px;
  overflow-y: auto;
  flex: 1;
}

.task-box {
  position: relative;
  border-radius: 12px;
  width: 100%;
  margin: 20px 0;
  padding: 16px;
  cursor: pointer;
  box-shadow: 2px 2px 4px 0px #ebebeb;
}
.task-box:hover {
  transform: scale(1.02);
}

.time {
  margin-bottom: 6px;
  opacity: 0.4;
  font-size: 10px;
}

.task-name {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.6;
}

.yellow {
  background-color: var(--box-color);
}

.blue {
  background-color: var(--box-color-2);
}

.red {
  background-color: var(--box-color-3);
}

.green {
  background-color: var(--box-color-4);
}

.more-button {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background-color: #8e92a4;
  box-shadow: 0 -4px 0 0 #8e92a4, 0 4px 0 0 #8e92a4;
  opacity: 0.4;
  right: 20px;
  top: 30px;
  cursor: pointer;
}

.members {
  display: flex;
  margin-top: 14px;
}
.members img {
  border-radius: 50%;
  width: 30px;
  height: 30px;
  margin-right: 4px;
  object-fit: cover;
}

.page-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 40px 20px 0 20px;
}
.page-content .header {
  font-size: 26px;
  color: var(--main-color);
  margin-top: 30px;
}

.content-categories {
  display: flex;
  justify-content: space-evenly;
  width: 100%;
  border-bottom: 1px solid #ddd;
  padding: 20px 0;
}

.nav-item {
  display: none;
}

.category {
  font-weight: 500;
  color: var(--secondary-color);
  border-bottom: 1px solid #ddd;
  transition: .4s ease-in;
  padding: 20px 30px;
  cursor: pointer;
}

#opt-1:checked + label,
#opt-2:checked + label,
#opt-3:checked + label,
#opt-4:checked + label {
  color: var(--checkbox-color);
  border-bottom: 2px solid var(--checkbox-color);
}

.task-item {
  display: none;
}

.tasks-wrapper {
  padding: 30px 0;
  flex: 1;
  overflow-y: auto;
  height: 100%;
  padding-right: 8px;
}

.task {
  align-items: center;
  justify-content: flex-start;
  display: flex;
  position: relative;
  margin-bottom: 16px;
  padding-left: 30px;
  color: var(--task-color);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 10px 10px 10px  rgba(0,0, 0, .3);
}
.task:hover {
  transform: translatex(2px);
}
.task label {
  cursor: pointer;
}

label .label-text {
  position: relative;
}

label .label-text:before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid #ddd;
  border-radius: 2px;
  left: -24px;
  transition: .2s ease;
}

.task-item:checked + label .label-text:before {
  background-color: var(--checkbox-color);
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-check'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 10px;
  background-position: center;
  border: 1px solid var(--checkbox-color);
}

.tag {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 20px;
  margin:10px 0px 10px 10px;
}
.tag.approved {
  background-color: var(--tag-color-one);
  color: var(--tag-color-text-one);
}
.tag.progress {
  background-color: var(--tag-color-two);
  color: var(--tag-color-text-two);
}
.tag.review {
  background-color: var(--tag-color-three);
  color: var(--tag-color-text-three);
}
.tag.waiting {
  background-color: var(--tag-color-four);
  color: var(--tag-color-text-four);
}

.upcoming {
  border-bottom: 1px solid #ddd;
  padding-bottom: 30px;
  margin-bottom: 30px;
}

@media screen and (max-width: 900px) {
  .left-bar {
    display: none;
  }
}
@media screen and (max-width: 700px) {
  .task-manager {
    flex-direction: column;
    overflow-y: auto;
  }

  .right-bar, .page-content {
    width: 100%;
    display: block;
  }

  .tasks-wrapper {
    height: auto;
  }
}
@media screen and (max-width: 520px) {
  .page-content {
    padding: 40px 10px 0 10px;
  }

  .right-content {
    padding: 10px 16px;
  }

  .category {
    padding: 20px;
  }
  
  .myhost{
    font-size: 24px;
    font-weight: 600;
    color: #000;
    line-height: 36px;
    margin-bottom: 48px;

  }
}
</style>
</head>
<body>


<div class="task-manager">

  <div class="page-content">
    <div class="myhost">我的主机</div>
    <div class="tasks-wrapper">
      {volist name="host" id="vh" key="key" empty='哇哦！您还没有主机哦！ <b onclick=jump_shop_host() style=color:red;>点我立即选购</b>'}
      <div class="task">
        <input class="task-item" name="task" type="checkbox" id="item-1" checked>
        <label for="item-1">
        {volist name="goods" id="vg" key="key"}
         {if condition="$vh.goods_id eq $vg.id"}{$vh.name} | {$vg.title}{/if}
         {/volist}
        </label>
        <span id="" class="tag {$vh.status==1?'approved':'review'}">服务器状态：{$vh.status==1?'运行中':'已关机'}</span>
        <span id="time{$vh.id}" class="tag approved">到期时间：</span>
        <span id="off{$vh.id}" class="tag red" onclick="web_off({$vh.id})">关机</span>
        <span id="on{$vh.id}" class="tag blue" onclick="web_on({$vh.id})">启动</span>
        <span id="guanli{$vh.id}" class="tag green" onclick="guanli({$vh.id},'{$vh.name}')">管理</span>
        <script>
            var month = '{$vh.month}';
            var seconds = month*30*24*3600;
            var time = '{$vh.time}';
            var time = Number(time)+Number(seconds);
            var times = new Date().getTime();
            var times = times/1000;
            var time = time-times;
            var time = time/60/60/24
            //tag 
            if(time>0){
                $('#time{$vh.id}').text('到期时间：'+Math.round(time)+'天')
            }else{
                $('#time{$vh.id}').text('到期时间：已到期');
                $('#time{$vh.id}').addClass("review");
                $('#time{$vh.id}').removeClass("approved");
                $('#guanli{$vh.id}').text('续费');
                $('#guanli{$vh.id}').attr('onclick','xufei({$vh.id})');
                $('#off{$vh.id}').remove();
                $('#on{$vh.id}').remove();
            }

        </script>
      </div>
      {/volist}
    </div>
  </div>
  <div class="right-bar">
    <div style="margin:40px 0px 0px 10px;">官方推荐</div>
    <div class="right-content">
      {volist name="_goods" id="vo" length="5"}
      <div class="task-box {$vo.css}">
        <div class="description-task">
          <div class="time">月付：{$vo.Ypricing}￥ &nbsp;年付：{$vo.Npricing}￥</div>
          <div class="task-name">{$vo.title}</div>
        </div>
        <!--<div class="more-button"><a href="/shop_confirm?id={$vo.id}" target="_blank">立即购买</a></div>-->
        <div class="more-button"><a href="javascript:shop_confirm({$vo.id})">立即购买</a></div>
        <div class="members">
          带宽：{$vo.bandwidth}MB 数据库：{$vo.mysql}MB 
          <br>
          网站大小：{$vo.web_size}GB
        </div>
      </div>
      {/volist}
    </div>
  </div>
</div>
<script src="__STATIC__/admin/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>

function guanli(id,webname){

    layer.open({
      title: '['+ webname + ']--服务器管理',
      type: 2,
      shade: false,
      area: ['500px', '400px'],
      maxmin: true,
      content: '/myhost_set?id=' + id +'&webname=' + webname,
      zIndex: layer.zIndex, //重点1
      success: function(layero){
        layer.setTop(layero); //重点2
      }
    });
    
}


function web_off(id){
    var index = layer.load(3);
    $.get('/web_off',{'id':id},function(res){
        if(res.code>0){
            layer.msg(res.msg,{icon:2});
            location.reload();
        }else{
            layer.msg(res.msg,{icon:1});
            layer.close(index);
            location.reload();
        }
    },'json');
}

function web_on(id){
    var index = layer.load(3);
    $.get('/web_on',{'id':id},function(res){
        if(res.code>0){
            layer.msg(res.msg,{icon:2});
            layer.close(index);
        }else{
            layer.msg(res.msg,{icon:1});
            layer.close(index);
            location.reload();
        }
    },'json');
}


            
function jump_shop_host(){
    window.open("/#xnzj","_blank");    
}

function shop_confirm(id){
    layer.open({
      title:'购买服务器',
      type: 2,
      shade: false,
      area: ['100%','100%'],
      maxmin: true,
      content: '/shop_confirm?id='+id,
      zIndex: layer.zIndex, //重点1
      success: function(layero){
        layer.setTop(layero); //重点2
      }
    });   
}
</script>

</body>
</html>